﻿@{
    Layout = null;
    int id = Convert.ToInt32(ViewBag.id);
}


<style>
    .myTabs.nav-tabs > li.active > a, .myTabs.nav-tabs > li.active > a:focus, .myTabs.nav-tabs > li.active > a:hover {
        color: #555;
        cursor: default;
        background-color: #fff;
        border: 1px solid #ddd;
        border-bottom-color: transparent;
    }
</style>


<div class="bs-example bs-example-tabs" data-example-id="togglable-tabs">
    <ul id="myTabs" class="myTabs nav nav-tabs" role="tablist">
        <li role="presentation" class="active">
            <a href="#home" id="home-tab" role="tab" data-toggle="tab" aria-controls="home" aria-expanded="true">收货地址</a>
        </li>
        <li role="presentation" class="">
            <a href="#profile" role="tab" id="profile-tab" data-toggle="tab" aria-controls="profile" aria-expanded="false">发货地址</a>
        </li>
    </ul>
    <div  class="tab-content">
        <div role="tabpanel" class="tab-pane fade active in" id="home" aria-labelledby="home-tab">
            <div class="row">
                <div class="col-md-6 col-xs-6 col-sm-6 text-left">
                    <button type="button" class="btn btn-success" onclick="$.MGJ.OrganizationalManage.Dialog_AddReAddress(@id)">
                        <i class="glyphicon glyphicon-plus"></i>
                        新增
                    </button>
                    <button type="button" class="btn btn-success" onclick="$.MGJ.OrganizationalManage.ExeclExporSend(@id,0)">
                        <i class="glyphicon glyphicon-share-alt"></i>
                        导出
                    </button>
                </div>
            </div>
            <table class="table table-hover table-bordered">
                <thead>
                    <tr>
                        <th class="text-center">收货人</th>
                        <th class="text-center">省</th>
                        <th class="text-center">市</th>
                        <th class="text-center">区</th>
                        <th class="text-center">详细地址</th>
                        <th class="text-center">邮编</th>
                        <th class="text-center">手机</th>
                        <th class="text-center">操作</th>
                    </tr>
                </thead>
                <tbody id="SendInfo" style="display:none;" binding="{'emptyHtml':SendInfo_EmptyHtml}">
                    <tr>
                        <td binding="{'text':'Person'}"></td>
                        <td binding="{'text':'ProvinceName'}"></td>
                        <td binding="{'text':'CityName'}"></td>
                        <td binding="{'text':'RegionName'}"></td>
                        <td binding="{'text':'Address'}"></td>
                        <td binding="{'text':'ZipCode'}"></td>
                        <td binding="{'text':'Mobile'}"></td>
                        <td>
                            <a href="#" binding="{'ID':'ID'}" onclick="$.MGJ.OrganizationalManage.Dialog_AddReAddress(@id,this,0)">编辑</a>
                            <a href="#" binding="{'ID':'ID'}" onclick="$.MGJ.OrganizationalManage.Ajax_DelSendInfo(@id,this,0)">删除</a>
                        </td>

                    </tr>
                </tbody>
            </table>
        </div>
        <div role="tabpanel" class="tab-pane fade" id="profile" aria-labelledby="profile-tab">
            <div class="row">
                <div class="col-md-6 col-xs-6 col-sm-6 text-left">
                    <button type="button" class="btn btn-success" onclick="$.MGJ.OrganizationalManage.Dialog_AddSendAddress(@id)">
                        <i class="glyphicon glyphicon-plus"></i>
                        新增
                    </button>
                    <button type="button" class="btn btn-success" onclick="$.MGJ.OrganizationalManage.ExeclExporSend(@id,1)">
                        <i class="glyphicon glyphicon-share-alt"></i>
                        导出
                    </button>
                </div>
                
            </div>
            <table class="table table-hover table-bordered">
                <thead>
                    <tr>
                        <th class="text-center">发货人</th>
                        <th class="text-center">省</th>
                        <th class="text-center">市</th>
                        <th class="text-center">区</th>
                        <th class="text-center">详细地址</th>
                        <th class="text-center">邮编</th>
                        <th class="text-center">手机</th>
                        <th class="text-center">操作</th>
                    </tr>
                </thead>
                <tbody id="SendOutInfo" style="display:none;" binding="{'emptyHtml':SendInfo_EmptyHtml}">
                    <tr>
                        <td binding="{'text':'Person'}"></td>
                        <td binding="{'text':'ProvinceName'}"></td>
                        <td binding="{'text':'CityName'}"></td>
                        <td binding="{'text':'RegionName'}"></td>
                        <td binding="{'text':'Address'}"></td>
                        <td binding="{'text':'ZipCode'}"></td>
                        <td binding="{'text':'Mobile'}"></td>
                        <td>
                            <a href="#" binding="{'ID':'ID'}" onclick="$.MGJ.OrganizationalManage.Dialog_AddSendAddress(@id,this,1)">编辑</a>
                            <a href="#" binding="{'ID':'ID'}" onclick="$.MGJ.OrganizationalManage.Ajax_DelSendInfo(@id,this,1)">删除</a>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
      
    </div>
</div>
<script>
    var ColspanNub = $(".table.table-hover.table-bordered").find("tr").children("td").length
    window.SendInfo_EmptyHtml = '<tr><td colspan="' + ColspanNub + '"><p class="no-result">无符合条件的数据结果</p></td></tr>';
    $(function () {
        $.MGJ.OrganizationalManage.Ajax_GetSendInfo(@id+0,0);
        $('.myTabs a[data-toggle="tab"][role="tab"]').on('shown.bs.tab', function (e) {
            if ($(e.target).text() === "收货地址") {
                $.MGJ.OrganizationalManage.Ajax_GetSendInfo(@id+0,0);
            }
            else{
                $.MGJ.OrganizationalManage.Ajax_GetSendInfo(@id+0,1);
            }
        })

    });
</script>
